import { http } from "../../utils/http";
// var classifyId=0;
Page({
  data: {
    list: [],    //童话列表
    page: 1,
    classifyId:0
  },
  async onLoad(e) {
    //  classifyId=e.classifyId;    //获取分类id
    this.data.classifyId=e.classifyId //获取分类id，赋值给data中的id
    this.getPage()
  },
  //页面触底
  onReachBottom() {
    //page累加
    this.data.page += 1;
    this.getPage()

  },
  //获取数据
  async getPage() {
    wx.showLoading({
      title: '正在加载',
    })
    let result = await http({
      url: "/1700-2",
      data: {
        // classifyId: classifyId,
        classifyId:this.data.classifyId,    //调用data中的id
        page: this.data.page
      }
    }).catch(err => {
      console.log(err);
      return;
    })
    this.setData({
      list: this.data.list.concat(result.data.showapi_res_body.contentlist)
    })
    wx.hideLoading()

  }
})